<?php
/**
 * Created by PhpStorm.
 * User: mr.lee
 * Date: 2018/11/15
 * Time: 12:36 PM
 */

namespace app\api\controller;


use app\common\model\Merchant;
use app\common\model\Paylog;
use Bank\HuifuServer;

class HuifuOrder extends Pub
{
    public function getorderreverse($param)
    {
        $Paylog = new Paylog();
        $orderinfo = $Paylog->where('orderid', $param['out_trade_no'])->find();
        $Merchant = new Merchant();
        $mchinfo = $Merchant->where('id', $orderinfo['mid'])->field('huifu_memberid,huifu_meroperid')->find();
        $JsonData['memberId'] = $mchinfo['huifu_memberid'];
        $JsonData['merOperId'] = $mchinfo['huifu_meroperid'];
        $JsonData['termOrdId'] = $orderinfo['orderid'];
        $JsonData['ordType'] = "1";
        $JsonData['apiVersion'] = "2.0.0.1";
        $JsonData['transDate'] = date('Ymd', $orderinfo['add_time']);
        $JsonData3 = json_encode($JsonData, JSON_UNESCAPED_UNICODE);

        $HuifuServer = new HuifuServer();
        $data['checkValue'] = $HuifuServer->sign($JsonData3);
        $data['jsonData'] = $JsonData3;
        $res = $HuifuServer->order_query($data);
        $rarr=$rarr = $this->pay_statu($res, $orderinfo['mid'], $orderinfo['orderid'],'checkpay');

        return $rarr;

    }

    public function getorderrefund()
    {

    }

    public function order_refund_query()
    {


    }

}